﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using GuideServices.Service.IService;
using Utilities.Configuration;
using Services.GetData.Entity;

namespace EnglishStudy.View
{
    public partial class Login : PhoneApplicationPage
    {
        public Login()
        {
            InitializeComponent();
            //LoginAPI();
            //SignUp();
            GetTypeName();
        }

        private void LoginWithFacebook_Click(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri(string.Format("/View/Facebook.Xaml"), UriKind.Relative));
        }

        private void Anonymous_Click(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri(string.Format("/MainPage.Xaml"), UriKind.Relative));
        }
       
        public async void LoginAPI()
        {
            var guideService = (IWebService)ApplicationContext.Instance.GetInstance(typeof(IWebService));
            var Login = await guideService.Login("sonlv", "abc");
        }
        public async void SignUp()
        {
            var guideService = (IWebService)ApplicationContext.Instance.GetInstance(typeof(IWebService));
            RequestUser user = new RequestUser()
            {
                Address = "Bang California",
                Avatar = "Hinh dep.jpg",
                Birthday = "12/12/2012",
                Email = "mam@gmail.com",
                FacebookID = string.Empty,
                FaceName = string.Empty,
                FullName = "Hoang van Ten",
                Gender = true,
                IdCountry = "2",
                Password = "abc",
                Username = "hoang",
                Zipcode = "123"
            };
            var Login = await guideService.SignUp(user);
        }

        public async void GetTypeName()
        {
             var guideService = (IWebService)ApplicationContext.Instance.GetInstance(typeof(IWebService));
             var GetType = await guideService.GetAllType("sonlv", "BDFABC3B8EED6F2D2C98C8CEE3CF9D49");            
        }

        private void Register_Click(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri(string.Format("/View/SignUpPage.xaml"), UriKind.Relative));
        }

    }
}